package com.lqjava.tuxiaowang.tuxiaowang.serverapp.app.api.common;

import com.lqjava.tuxiaowang.tuxiaowang.beans.entity.request.LoginRequest;
import com.lqjava.tuxiaowang.tuxiaowang.beans.result.ResultBean;
import com.lqjava.tuxiaowang.tuxiaowang.beans.utils.ParamsHelper;
import com.lqjava.tuxiaowang.tuxiaowang.serverapp.app.service.AccountBaseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

/**
 * 系统默认api
 * 包含登录 获取用户信息等
 * @author lq 2021年3月21日 19:05:28
 */
@Controller
public class CommonApi {


    @Autowired
    private AccountBaseService accountBaseService;

    @RequestMapping(value = "/open/login",method = RequestMethod.POST,name = "账号密码登录接口")
    public ResultBean<String> login(@RequestBody LoginRequest request){
        ParamsHelper.requiredValidator(request);
        ResultBean<String> res = new ResultBean<>();
        res.initTrue(accountBaseService.login(request));
        return res;
    }


}
